Change in openvpn[master]: dco_linux: use M_FATAL instead of M_ERR in netlink error code paths
A message that is not in the archive (sent off-list or not yet received): gerrit.1753215725000.Ifc442b4426c02de7282d0f69629e8a10b679c589@...2715...
Attention is currently required from: flichtenheld, plaisthos.
Hello plaisthos, flichtenheld,
I'd like you to do a code review.
Please visit
http://gerrit.openvpn.net/c/openvpn/+/1096?usp=email
to review the following change.
Change subject: dco_linux: use M_FATAL instead of M_ERR in netlink error code paths
......................................................................
dco_linux: use M_FATAL instead of M_ERR in netlink error code paths
Netlink code doesn't set errno upon error (with the exception of any *alloc() function which probably inherits the errno=ENOMEM from the underlying malloc call), therefore we should not print error messages with M_ERR, but rather rely on M_FATAL.
M_ERR is equivalent to M_FATAL with the addition of appending ": $errno" to the error string.
Since errno is not meaningful in this context, we can just opt for the less confusing M_FATAL.
---
M src/openvpn/dco_linux.c
1 file changed, 9 insertions(+), 9 deletions(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/96/1096/1
src/openvpn/dco_linux.c +9 -9
@@ -114,7 +114,7 @@struct nl_msg *nl_msg =nlmsg_alloc ();if (!nl_msg) { -msg (M_ERR ,"cannot allocate netlink message" ); +msg (M_FATAL ,"cannot allocate netlink message" );return NULL ; }
@@ -140,7 +140,7 @@break ;case -NLE_NOMEM : -msg (M_ERR ,"%s: netlink out of memory error" , prefix); +msg (M_FATAL ,"%s: netlink out of memory error" , prefix);break ;case -NLE_AGAIN :
@@ -148,7 +148,7 @@break ;case -NLE_NODEV : -msg (M_ERR ,"%s: netlink reports device not found:" , prefix); +msg (M_FATAL ,"%s: netlink reports device not found:" , prefix);break ;case -NLE_OBJ_NOTFOUND :
@@ -387,19 +387,19 @@static void ovpn_dco_init_netlink (dco_context_t *dco) { - dco->ovpn_dco_id =resolve_ovpn_netlink_id (M_ERR ); + dco->ovpn_dco_id =resolve_ovpn_netlink_id (M_FATAL ); dco->nl_sock =nl_socket_alloc ();if (!dco->nl_sock) { -msg (M_ERR ,"Cannot create netlink socket" ); +msg (M_FATAL ,"Cannot create netlink socket" ); }int ret =genl_connect (dco->nl_sock);if (ret) { -msg (M_ERR ,"Cannot connect to generic netlink: %s" , +msg (M_FATAL ,"Cannot connect to generic netlink: %s" ,nl_geterror (ret)); }
@@ -415,7 +415,7 @@ dco->nl_cb =nl_cb_alloc (NL_CB_DEFAULT );if (!dco->nl_cb) { -msg (M_ERR ,"failed to allocate netlink callback" ); +msg (M_FATAL ,"failed to allocate netlink callback" ); }nl_socket_set_cb (dco->nl_sock, dco->nl_cb);
@@ -484,7 +484,7 @@if (dco->ovpn_dco_mcast_id <0 ) { -msg (M_ERR ,"cannot get mcast group: %s" ,nl_geterror (dco->ovpn_dco_mcast_id)); +msg (M_FATAL ,"cannot get mcast group: %s" ,nl_geterror (dco->ovpn_dco_mcast_id)); }/* Register for ovpn-dco specific multicast messages that the kernel may
@@ -493,7 +493,7 @@int ret =nl_socket_add_membership (dco->nl_sock, dco->ovpn_dco_mcast_id);if (ret) { -msg (M_ERR ,"%s: failed to join groups: %d" , __func__, ret); +msg (M_FATAL ,"%s: failed to join groups: %d" , __func__, ret); } }
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1096?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ifc442b4426c02de7282d0f69629e8a10b679c589
Gerrit-Change-Number: 1096
Gerrit-PatchSet: 1
Gerrit-Owner: ordex <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-MessageType: newchange
Attention is currently required from: flichtenheld, ordex, plaisthos.
cron2 has posted comments on this change. ( http://gerrit.openvpn.net/c/openvpn/+/1096?usp=email )
Change subject: dco_linux: use M_FATAL instead of M_ERR in netlink error code paths
......................................................................
Patch Set 2: Code-Review+2
(1 comment)
Patchset:
PS2:
makes sense
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1096?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ifc442b4426c02de7282d0f69629e8a10b679c589
Gerrit-Change-Number: 1096
Gerrit-PatchSet: 2
Gerrit-Owner: ordex <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Attention: ordex <[email protected]...>
Gerrit-Comment-Date: Wed, 23 Jul 2025 06:30:12 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment
PATCH v2 1/1 dco_linux: use M_FATAL instead of M_ERR in netlink error code paths
In reply to a message not in the archiveFrom: Antonio Quartulli <[email protected]...>
Netlink code doesn't set errno upon error (with the exception of any *alloc() function which probably inherits the errno=ENOMEM from the underlying malloc call), therefore we should not print error messages with M_ERR, but rather rely on M_FATAL.
M_ERR is equivalent to M_FATAL with the addition of appending ": $errno" to the error string.
Since errno is not meaningful in this context, we can just opt for the less confusing M_FATAL.
---
This change was reviewed on Gerrit and approved by at least one developer. I request to merge it to master.
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1096
This mail reflects revision 2 of this Change.
Acked-by according to Gerrit (reflected above):
Gert Doering <[email protected]...>
src/openvpn/dco_linux.c +9 -9
@@ -114,7 +114,7 @@struct nl_msg *nl_msg =nlmsg_alloc ();if (!nl_msg) { -msg (M_ERR ,"cannot allocate netlink message" ); +msg (M_FATAL ,"cannot allocate netlink message" );return NULL ; }
@@ -140,7 +140,7 @@break ;case -NLE_NOMEM : -msg (M_ERR ,"%s: netlink out of memory error" , prefix); +msg (M_FATAL ,"%s: netlink out of memory error" , prefix);break ;case -NLE_AGAIN :
@@ -148,7 +148,7 @@break ;case -NLE_NODEV : -msg (M_ERR ,"%s: netlink reports device not found:" , prefix); +msg (M_FATAL ,"%s: netlink reports device not found:" , prefix);break ;case -NLE_OBJ_NOTFOUND :
@@ -387,19 +387,19 @@static void ovpn_dco_init_netlink (dco_context_t *dco) { - dco->ovpn_dco_id =resolve_ovpn_netlink_id (M_ERR ); + dco->ovpn_dco_id =resolve_ovpn_netlink_id (M_FATAL ); dco->nl_sock =nl_socket_alloc ();if (!dco->nl_sock) { -msg (M_ERR ,"Cannot create netlink socket" ); +msg (M_FATAL ,"Cannot create netlink socket" ); }int ret =genl_connect (dco->nl_sock);if (ret) { -msg (M_ERR ,"Cannot connect to generic netlink: %s" , +msg (M_FATAL ,"Cannot connect to generic netlink: %s" ,nl_geterror (ret)); }
@@ -415,7 +415,7 @@ dco->nl_cb =nl_cb_alloc (NL_CB_DEFAULT );if (!dco->nl_cb) { -msg (M_ERR ,"failed to allocate netlink callback" ); +msg (M_FATAL ,"failed to allocate netlink callback" ); }nl_socket_set_cb (dco->nl_sock, dco->nl_cb);
@@ -484,7 +484,7 @@if (dco->ovpn_dco_mcast_id <0 ) { -msg (M_ERR ,"cannot get mcast group: %s" ,nl_geterror (dco->ovpn_dco_mcast_id)); +msg (M_FATAL ,"cannot get mcast group: %s" ,nl_geterror (dco->ovpn_dco_mcast_id)); }/* Register for ovpn-dco specific multicast messages that the kernel may
@@ -493,7 +493,7 @@int ret =nl_socket_add_membership (dco->nl_sock, dco->ovpn_dco_mcast_id);if (ret) { -msg (M_ERR ,"%s: failed to join groups: %d" , __func__, ret); +msg (M_FATAL ,"%s: failed to join groups: %d" , __func__, ret); } }
[Openvpn-devel] [PATCH applied] Re: dco_linux: use M_FATAL instead of M_ERR in netlink error code paths
Stared at the code, this is all "in netlink error handling", so the changes makes sense.
Your patch has been applied to the master branch.
commit dfe71b0a397273efffabbc01d1f6a9933f607933
Author: Antonio Quartulli Date: Wed Jul 23 08:30:30 2025 +0200
dco_linux: use M_FATAL instead of M_ERR in netlink error code paths
Signed-off-by: Antonio Quartulli <[email protected]...>
Acked-by: Gert Doering <[email protected]...>
Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg32271.html
Signed-off-by: Gert Doering <[email protected]...>--
kind regards,
Gert Doering
cron2 has uploaded a new patch set (#3) to the change originally created by ordex. ( http://gerrit.openvpn.net/c/openvpn/+/1096?usp=email )
The following approvals got outdated and were removed:
Code-Review+2 by cron2
Change subject: dco_linux: use M_FATAL instead of M_ERR in netlink error code paths
......................................................................
dco_linux: use M_FATAL instead of M_ERR in netlink error code paths
Netlink code doesn't set errno upon error (with the exception of any *alloc() function which probably inherits the errno=ENOMEM from the underlying malloc call), therefore we should not print error messages with M_ERR, but rather rely on M_FATAL.
M_ERR is equivalent to M_FATAL with the addition of appending ": $errno" to the error string.
Since errno is not meaningful in this context, we can just opt for the less confusing M_FATAL.
Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg32271.html
---
M src/openvpn/dco_linux.c
1 file changed, 9 insertions(+), 9 deletions(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/96/1096/3
src/openvpn/dco_linux.c +9 -9
@@ -114,7 +114,7 @@struct nl_msg *nl_msg =nlmsg_alloc ();if (!nl_msg) { -msg (M_ERR ,"cannot allocate netlink message" ); +msg (M_FATAL ,"cannot allocate netlink message" );return NULL ; }
@@ -140,7 +140,7 @@break ;case -NLE_NOMEM : -msg (M_ERR ,"%s: netlink out of memory error" , prefix); +msg (M_FATAL ,"%s: netlink out of memory error" , prefix);break ;case -NLE_AGAIN :
@@ -148,7 +148,7 @@break ;case -NLE_NODEV : -msg (M_ERR ,"%s: netlink reports device not found:" , prefix); +msg (M_FATAL ,"%s: netlink reports device not found:" , prefix);break ;case -NLE_OBJ_NOTFOUND :
@@ -387,19 +387,19 @@static void ovpn_dco_init_netlink (dco_context_t *dco) { - dco->ovpn_dco_id =resolve_ovpn_netlink_id (M_ERR ); + dco->ovpn_dco_id =resolve_ovpn_netlink_id (M_FATAL ); dco->nl_sock =nl_socket_alloc ();if (!dco->nl_sock) { -msg (M_ERR ,"Cannot create netlink socket" ); +msg (M_FATAL ,"Cannot create netlink socket" ); }int ret =genl_connect (dco->nl_sock);if (ret) { -msg (M_ERR ,"Cannot connect to generic netlink: %s" , +msg (M_FATAL ,"Cannot connect to generic netlink: %s" ,nl_geterror (ret)); }
@@ -415,7 +415,7 @@ dco->nl_cb =nl_cb_alloc (NL_CB_DEFAULT );if (!dco->nl_cb) { -msg (M_ERR ,"failed to allocate netlink callback" ); +msg (M_FATAL ,"failed to allocate netlink callback" ); }nl_socket_set_cb (dco->nl_sock, dco->nl_cb);
@@ -478,7 +478,7 @@if (dco->ovpn_dco_mcast_id <0 ) { -msg (M_ERR ,"cannot get mcast group: %s" ,nl_geterror (dco->ovpn_dco_mcast_id)); +msg (M_FATAL ,"cannot get mcast group: %s" ,nl_geterror (dco->ovpn_dco_mcast_id)); }/* Register for ovpn-dco specific multicast messages that the kernel may
@@ -487,7 +487,7 @@int ret =nl_socket_add_membership (dco->nl_sock, dco->ovpn_dco_mcast_id);if (ret) { -msg (M_ERR ,"%s: failed to join groups: %d" , __func__, ret); +msg (M_FATAL ,"%s: failed to join groups: %d" , __func__, ret); } }
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1096?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ifc442b4426c02de7282d0f69629e8a10b679c589
Gerrit-Change-Number: 1096
Gerrit-PatchSet: 3
Gerrit-Owner: ordex <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-MessageType: newpatchset
cron2 has submitted this change. ( http://gerrit.openvpn.net/c/openvpn/+/1096?usp=email )
Change subject: dco_linux: use M_FATAL instead of M_ERR in netlink error code paths
......................................................................
dco_linux: use M_FATAL instead of M_ERR in netlink error code paths
Netlink code doesn't set errno upon error (with the exception of any *alloc() function which probably inherits the errno=ENOMEM from the underlying malloc call), therefore we should not print error messages with M_ERR, but rather rely on M_FATAL.
M_ERR is equivalent to M_FATAL with the addition of appending ": $errno" to the error string.
Since errno is not meaningful in this context, we can just opt for the less confusing M_FATAL.
Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg32271.html
---
M src/openvpn/dco_linux.c
1 file changed, 9 insertions(+), 9 deletions(-)
src/openvpn/dco_linux.c +9 -9
@@ -114,7 +114,7 @@struct nl_msg *nl_msg =nlmsg_alloc ();if (!nl_msg) { -msg (M_ERR ,"cannot allocate netlink message" ); +msg (M_FATAL ,"cannot allocate netlink message" );return NULL ; }
@@ -140,7 +140,7 @@break ;case -NLE_NOMEM : -msg (M_ERR ,"%s: netlink out of memory error" , prefix); +msg (M_FATAL ,"%s: netlink out of memory error" , prefix);break ;case -NLE_AGAIN :
@@ -148,7 +148,7 @@break ;case -NLE_NODEV : -msg (M_ERR ,"%s: netlink reports device not found:" , prefix); +msg (M_FATAL ,"%s: netlink reports device not found:" , prefix);break ;case -NLE_OBJ_NOTFOUND :
@@ -387,19 +387,19 @@static void ovpn_dco_init_netlink (dco_context_t *dco) { - dco->ovpn_dco_id =resolve_ovpn_netlink_id (M_ERR ); + dco->ovpn_dco_id =resolve_ovpn_netlink_id (M_FATAL ); dco->nl_sock =nl_socket_alloc ();if (!dco->nl_sock) { -msg (M_ERR ,"Cannot create netlink socket" ); +msg (M_FATAL ,"Cannot create netlink socket" ); }int ret =genl_connect (dco->nl_sock);if (ret) { -msg (M_ERR ,"Cannot connect to generic netlink: %s" , +msg (M_FATAL ,"Cannot connect to generic netlink: %s" ,nl_geterror (ret)); }
@@ -415,7 +415,7 @@ dco->nl_cb =nl_cb_alloc (NL_CB_DEFAULT );if (!dco->nl_cb) { -msg (M_ERR ,"failed to allocate netlink callback" ); +msg (M_FATAL ,"failed to allocate netlink callback" ); }nl_socket_set_cb (dco->nl_sock, dco->nl_cb);
@@ -478,7 +478,7 @@if (dco->ovpn_dco_mcast_id <0 ) { -msg (M_ERR ,"cannot get mcast group: %s" ,nl_geterror (dco->ovpn_dco_mcast_id)); +msg (M_FATAL ,"cannot get mcast group: %s" ,nl_geterror (dco->ovpn_dco_mcast_id)); }/* Register for ovpn-dco specific multicast messages that the kernel may
@@ -487,7 +487,7 @@int ret =nl_socket_add_membership (dco->nl_sock, dco->ovpn_dco_mcast_id);if (ret) { -msg (M_ERR ,"%s: failed to join groups: %d" , __func__, ret); +msg (M_FATAL ,"%s: failed to join groups: %d" , __func__, ret); } }
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1096?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ifc442b4426c02de7282d0f69629e8a10b679c589
Gerrit-Change-Number: 1096
Gerrit-PatchSet: 3
Gerrit-Owner: ordex <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-MessageType: merged